home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / MPW Interfaces & Libraries / PInterfaces / PPCToolBox.p < prev    next >
Encoding:
Text File  |  1992-01-29  |  13.6 KB  |  389 lines  |  [TEXT/MPS ]

  1.  
  2. {
  3. Created: Thursday, September 5, 1991 at 5:57 PM
  4.  PPCToolBox.p
  5.  Pascal Interface to the Macintosh Libraries
  6.  
  7.   Copyright Apple Computer, Inc. 1989-1991
  8.   All rights reserved
  9. }
  10.  
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.  UNIT PPCToolBox;
  18.  INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingPPCToolBox}
  22. {$SETC UsingPPCToolBox := 1}
  23.  
  24. {$I+}
  25. {$SETC PPCToolBoxIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingAppleTalk}
  28. {$I $$Shell(PInterfaces)AppleTalk.p}
  29. {$ENDC}
  30. {$IFC UNDEFINED UsingMemory}
  31. {$I $$Shell(PInterfaces)Memory.p}
  32. {$ENDC}
  33. {$IFC UNDEFINED UsingTypes}
  34. {$I $$Shell(PInterfaces)Types.p}
  35. {$ENDC}
  36. {$SETC UsingIncludes := PPCToolBoxIncludes}
  37.  
  38. CONST
  39.  
  40. {The following is temporarily placed here, later it will be moved to GestaltEqu}
  41. gestaltPPCSupportsStoreAndForward = $2000;
  42. gestaltPPCVersionAttr = 'ppcv';
  43.  
  44. TYPE
  45. PPCServiceType = SignedByte;
  46.  
  47. CONST
  48. ppcServiceRealTime = 1;
  49. ppcServiceStoreAndForward = 2;
  50.  
  51. TYPE
  52. PPCLocationKind = INTEGER;
  53.  
  54. CONST
  55. ppcNoLocation = 0;                            { There is no PPCLocName }
  56. ppcNBPLocation = 1;                            { Use AppleTalk NBP      }
  57. ppcNBPTypeLocation = 2;                        { Used for specifying a location name type during PPCOpen only }
  58.  
  59. TYPE
  60. PPCPortKinds = INTEGER;
  61.  
  62. CONST
  63. ppcByCreatorAndType = 1;                    { Port type is specified as colloquial Mac creator and type }
  64. ppcByString = 2;                            { Port type is in pascal string format }
  65.  
  66. TYPE
  67. PPCSessionOrigin = SignedByte;                { Values returned for request field in PPCInform call }
  68.  
  69. CONST
  70.  
  71. { Values returned for requestType field in PPCInform call }
  72. ppcLocalOrigin = 1;                            { session originated from this machine }
  73. ppcRemoteOrigin = 2;                        { session originated from remote machine }
  74.  
  75. TYPE
  76. PPCPortRefNum = INTEGER;
  77. PPCSessRefNum = LONGINT;
  78.  
  79. PPCPortPtr = ^PPCPortRec;
  80. PPCPortRec = RECORD
  81.  nameScript: ScriptCode;                    { script of name }
  82.  name: Str32;                                { name of port as seen in browser }
  83.  portKindSelector: PPCPortKinds;            { which variant }
  84.  CASE PPCPortKinds OF
  85.    ppcByString:
  86.   (portTypeStr: Str32);
  87.    ppcByCreatorAndType:
  88.   (portCreator: OSType;
  89.   portType: OSType);
  90.  END;
  91.  
  92. LocationNamePtr = ^LocationNameRec;
  93. LocationNameRec = RECORD
  94.  locationKindSelector: PPCLocationKind;        { which variant }
  95.  CASE PPCLocationKind OF
  96.    ppcNBPLocation:
  97.   (nbpEntity: EntityName);                    { NBP name entity }
  98.    ppcNBPTypeLocation:
  99.   (nbpType: Str32);                            { just the NBP type string, for PPCOpen }
  100.  END;
  101.  
  102. PortInfoPtr = ^PortInfoRec;
  103. PortInfoRec = RECORD
  104.  filler1: SignedByte;
  105.  authRequired: BOOLEAN;
  106.  name: PPCPortRec;
  107.  END;
  108.  
  109.  
  110. PortInfoArrayPtr = ^PortInfoArray;
  111. PortInfoArray = ARRAY [0..0] OF PortInfoRec;
  112. { Procedures you will need to write }
  113. PPCFilterProcPtr = ProcPtr;                    { FUNCTION MyPortFilter(locationName: LocationNameRec; thePortInfo: PortInfoRec): BOOLEAN; }
  114. PPCCompProcPtr = ProcPtr;                    { PROCEDURE MyCompletionRoutine(pb: PPCParamBlockPtr); }
  115.  
  116. PPCOpenPBPtr = ^PPCOpenPBRec;
  117. PPCOpenPBRec = RECORD
  118.     qLink:   Ptr;                             { reserved }
  119.     csCode:   INTEGER;                        { reserved }
  120.     intUse:   INTEGER;                        { reserved }
  121.     intUsePtr:  Ptr;                         { reserved }
  122.     ioCompletion: PPCCompProcPtr;
  123.     ioResult:  OSErr;
  124.     reserved:  ARRAY [1..5] OF LONGINT;        { reserved }
  125.     portRefNum:  PPCPortRefNum;               { 38 <--   Port Reference          }   
  126.     filler1:  LONGINT;     
  127.     serviceType: PPCServiceType;               { 44 -->   Bit field describing the requested port service  } 
  128.     resFlag:  SignedByte;                    { 45 -->   Must be set to 0          }
  129.     portName:  PPCPortPtr;                    { 46 -->   PortName for PPC           }
  130.     locationName: LocationNamePtr;          { 50 -->   If NBP  Registration is required       }
  131.     networkVisible: BOOLEAN;                 { 54 -->   make this network visible on network      }
  132.     nbpRegistered: BOOLEAN;                 { 55 <--   The given location name was registered on the network }
  133.    END;
  134.  
  135. PPCInformPBPtr = ^PPCInformPBRec;
  136. PPCInformPBRec = RECORD
  137.  qLink: Ptr;                                { reserved }
  138.  csCode: INTEGER;                            { reserved }
  139.  intUse: INTEGER;                            { reserved }
  140.  intUsePtr: Ptr;                            { reserved }
  141.  ioCompletion: PPCCompProcPtr;
  142.  ioResult: OSErr;
  143.  reserved: ARRAY [1..5] OF LONGINT;            { reserved }
  144.  portRefNum: PPCPortRefNum;                    { 38 -->   Port Identifier }
  145.  sessRefNum: PPCSessRefNum;                    { 40 <--   Session Reference }
  146.  serviceType: PPCServiceType;                { 44 <--   Status Flags for type of session, local, remote }
  147.  autoAccept: BOOLEAN;                        { 45 -->   if true session will be accepted automatically }
  148.  portName: PPCPortPtr;                        { 46 -->   Buffer for Source PPCPortRec }
  149.  locationName: LocationNamePtr;                { 50 -->   Buffer for Source LocationNameRec }
  150.  userName: StringPtr;                        { 54 -->   Buffer for Soure user's name trying to link. }
  151.  userData: LONGINT;                            { 58 <--   value included in PPCStart's userData }
  152.  requestType: PPCSessionOrigin;                { 62 <--   Local or Network }
  153.  END;
  154.  
  155. PPCStartPBPtr = ^PPCStartPBRec;
  156. PPCStartPBRec = RECORD
  157.  qLink: Ptr;                                { reserved }
  158.  csCode: INTEGER;                            { reserved }
  159.  intUse: INTEGER;                            { reserved }
  160.  intUsePtr: Ptr;                            { reserved }
  161.  ioCompletion: PPCCompProcPtr;
  162.  ioResult: OSErr;
  163.  reserved: ARRAY [1..5] OF LONGINT;            { reserved }
  164.  portRefNum: PPCPortRefNum;                    { 38 -->   Port Identifier }
  165.  sessRefNum: PPCSessRefNum;                    { 40 <--   Session Reference }
  166.  serviceType: PPCServiceType;                { 44 <--   Actual service method (realTime) }
  167.  resFlag: SignedByte;                        { 45 -->   Must be set to 0  }
  168.  portName: PPCPortPtr;                        { 46 -->   Destination portName }
  169.  locationName: LocationNamePtr;                { 50 -->   NBP or NAS style service location name }
  170.  rejectInfo: LONGINT;                        { 54 <--   reason for rejecting the session request }
  171.  userData: LONGINT;                            { 58 -->   Copied to destination PPCInform parameter block }
  172.  userRefNum: LONGINT;                        { 62 -->   userRefNum (obtained during login process)  }
  173.  END;
  174.  
  175. PPCAcceptPBPtr = ^PPCAcceptPBRec;
  176. PPCAcceptPBRec = RECORD
  177.  qLink: Ptr;                                { reserved }
  178.  csCode: INTEGER;                            { reserved }
  179.  intUse: INTEGER;                            { reserved }
  180.  intUsePtr: Ptr;                            { reserved }
  181.  ioCompletion: PPCCompProcPtr;
  182.  ioResult: OSErr;
  183.  reserved: ARRAY [1..5] OF LONGINT;            { reserved }
  184.  filler1: INTEGER;
  185.  sessRefNum: PPCSessRefNum;                    { 40 -->   Session Reference }
  186.  END;
  187.  
  188. PPCRejectPBPtr = ^PPCRejectPBRec;
  189. PPCRejectPBRec = RECORD
  190.  qLink: Ptr;                                { reserved }
  191.  csCode: INTEGER;                            { reserved }
  192.  intUse: INTEGER;                            { reserved }
  193.  intUsePtr: Ptr;                            { reserved }
  194.  ioCompletion: PPCCompProcPtr;
  195.  ioResult: OSErr;
  196.  reserved: ARRAY [1..5] OF LONGINT;            { reserved }
  197.  filler1: INTEGER;
  198.  sessRefNum: PPCSessRefNum;                    { 40 -->   Session Reference }
  199.  filler2: INTEGER;
  200.  filler3: LONGINT;
  201.  filler4: LONGINT;
  202.  rejectInfo: LONGINT;                        { 54 -->   reason for rejecting the session request  }
  203.  END;
  204.  
  205. PPCWritePBPtr = ^PPCWritePBRec;
  206. PPCWritePBRec = RECORD
  207.  qLink: Ptr;                                { reserved }
  208.  csCode: INTEGER;                            { reserved }
  209.  intUse: INTEGER;                            { reserved }
  210.  intUsePtr: Ptr;                            { reserved }
  211.  ioCompletion: PPCCompProcPtr;
  212.  ioResult: OSErr;
  213.  reserved: ARRAY [1..5] OF LONGINT;            { reserved }
  214.  filler1: INTEGER;
  215.  sessRefNum: PPCSessRefNum;                    { 40 -->   Session Reference }
  216.  bufferLength: Size;                        { 44 -->   Length of the message buffer }
  217.  actualLength: Size;                        { 48 <--   Actual Length Written }
  218.  bufferPtr: Ptr;                            { 52 -->   Pointer to message buffer }
  219.  more: BOOLEAN;                                { 56 -->   if more data in this block will be written }
  220.  filler2: SignedByte;
  221.  userData: LONGINT;                            { 58 -->   Message block userData Uninterpreted by PPC }
  222.  blockCreator: OSType;                        { 62 -->   Message block creator Uninterpreted by PPC }
  223.  blockType: OSType;                            { 66 -->   Message block type Uninterpreted by PPC }
  224.  END;
  225.  
  226. PPCReadPBPtr = ^PPCReadPBRec;
  227. PPCReadPBRec = RECORD
  228.  qLink: Ptr;                                { reserved }
  229.  csCode: INTEGER;                            { reserved }
  230.  intUse: INTEGER;                            { reserved }
  231.  intUsePtr: Ptr;                            { reserved }
  232.  ioCompletion: PPCCompProcPtr;
  233.  ioResult: OSErr;
  234.  reserved: ARRAY [1..5] OF LONGINT;            { reserved }
  235.  filler1: INTEGER;
  236.  sessRefNum: PPCSessRefNum;                    { 40 -->   Session Reference }
  237.  bufferLength: Size;                        { 44 -->   Length of the message buffer }
  238.  actualLength: Size;                        { 48 <--   Actual length read }
  239.  bufferPtr: Ptr;                            { 52 -->   Pointer to message buffer }
  240.  more: BOOLEAN;                                { 56 <--   if true more data in this block to be read }
  241.  filler2: SignedByte;
  242.  userData: LONGINT;                            { 58 <--   Message block userData Uninterpreted by PPC }
  243.  blockCreator: OSType;                        { 62 <--   Message block creator Uninterpreted by PPC }
  244.  blockType: OSType;                            { 66 <--   Message block type Uninterpreted by PPC }
  245.  END;
  246.  
  247. PPCEndPBPtr = ^PPCEndPBRec;
  248. PPCEndPBRec = RECORD
  249.  qLink: Ptr;                                { reserved }
  250.  csCode: INTEGER;                            { reserved }
  251.  intUse: INTEGER;                            { reserved }
  252.  intUsePtr: Ptr;                            { reserved }
  253.  ioCompletion: PPCCompProcPtr;
  254.  ioResult: OSErr;
  255.  reserved: ARRAY [1..5] OF LONGINT;            { reserved }
  256.  filler1: INTEGER;
  257.  sessRefNum: PPCSessRefNum;                    { 40 -->   Session Reference }
  258.  END;
  259.  
  260. PPCClosePBPtr = ^PPCClosePBRec;
  261. PPCClosePBRec = RECORD
  262.  qLink: Ptr;                                { reserved }
  263.  csCode: INTEGER;                            { reserved }
  264.  intUse: INTEGER;                            { reserved }
  265.  intUsePtr: Ptr;                            { reserved }
  266.  ioCompletion: PPCCompProcPtr;
  267.  ioResult: OSErr;
  268.  reserved: ARRAY [1..5] OF LONGINT;            { reserved }
  269.  portRefNum: PPCPortRefNum;                    { 38 -->   Port Identifier }
  270.  END;
  271.  
  272. IPCListPortsPBPtr = ^IPCListPortsPBRec;
  273. IPCListPortsPBRec = RECORD
  274.  qLink: Ptr;                                { reserved }
  275.  csCode: INTEGER;                            { reserved }
  276.  intUse: INTEGER;                            { reserved }
  277.  intUsePtr: Ptr;                            { reserved }
  278.  ioCompletion: PPCCompProcPtr;
  279.  ioResult: OSErr;
  280.  reserved: ARRAY [1..5] OF LONGINT;            { reserved }
  281.  filler1: INTEGER;
  282.  startIndex: INTEGER;                        { 40 -->   Start Index }
  283.  requestCount: INTEGER;                        { 42 -->   Number of entries to be returned }
  284.  actualCount: INTEGER;                        { 44 <--   Actual Number of entries to be returned }
  285.  portName: PPCPortPtr;                        { 46 -->   PortName Match }
  286.  locationName: LocationNamePtr;                { 50 -->   NBP or NAS type name to locate the Port Location }
  287.  bufferPtr: PortInfoArrayPtr;                { 54 -->   Pointer to a buffer requestCount*sizeof(PortInfo) bytes big }
  288.  END;
  289.  
  290. PPCParamBlockPtr = ^PPCParamBlockRec;
  291. PPCParamBlockRec = RECORD
  292.      CASE Integer OF
  293.       0: (openParam:   PPCOpenPBRec);
  294.       1: (informParam: PPCInformPBRec);
  295.       2: (startParam:  PPCStartPBRec);
  296.       3: (acceptParam: PPCAcceptPBRec);
  297.       4: (rejectParam: PPCRejectPBRec);
  298.       5: (writeParam:  PPCWritePBRec);
  299.       6: (readParam:   PPCReadPBRec);
  300.       7: (endParam:  PPCEndPBRec);
  301.       8: (closeParam:  PPCClosePBRec);
  302.       9: (listPortsParam: IPCListPortsPBRec);
  303.     END;
  304.  
  305.  
  306.  
  307. {  PPC Calling Conventions  }
  308. FUNCTION PPCInit: OSErr;
  309.  INLINE $7000,$A0DD,$3E80;
  310. FUNCTION PPCOpen(pb: PPCOpenPBPtr;async: BOOLEAN): OSErr;
  311. FUNCTION PPCOpenSync(pb: PPCOpenPBPtr): OSErr;
  312.  INLINE $205F,$7001,$A0DD,$3E80;
  313. FUNCTION PPCOpenAsync(pb: PPCOpenPBPtr): OSErr;
  314.  INLINE $205F,$7001,$A4DD,$3E80;
  315. FUNCTION PPCInform(pb: PPCInformPBPtr;async: BOOLEAN): OSErr;
  316. FUNCTION PPCInformSync(pb: PPCInformPBPtr): OSErr;
  317.  INLINE $205F,$7003,$A0DD,$3E80;
  318. FUNCTION PPCInformAsync(pb: PPCInformPBPtr): OSErr;
  319.  INLINE $205F,$7003,$A4DD,$3E80;
  320. FUNCTION PPCStart(pb: PPCStartPBPtr;async: BOOLEAN): OSErr;
  321. FUNCTION PPCStartSync(pb: PPCStartPBPtr): OSErr;
  322.  INLINE $205F,$7002,$A0DD,$3E80;
  323. FUNCTION PPCStartAsync(pb: PPCStartPBPtr): OSErr;
  324.  INLINE $205F,$7002,$A4DD,$3E80;
  325. FUNCTION PPCAccept(pb: PPCAcceptPBPtr;async: BOOLEAN): OSErr;
  326. FUNCTION PPCAcceptSync(pb: PPCAcceptPBPtr): OSErr;
  327.  INLINE $205F,$7004,$A0DD,$3E80;
  328. FUNCTION PPCAcceptAsync(pb: PPCAcceptPBPtr): OSErr;
  329.  INLINE $205F,$7004,$A4DD,$3E80;
  330. FUNCTION PPCReject(pb: PPCRejectPBPtr;async: BOOLEAN): OSErr;
  331. FUNCTION PPCRejectSync(pb: PPCRejectPBPtr): OSErr;
  332.  INLINE $205F,$7005,$A0DD,$3E80;
  333. FUNCTION PPCRejectAsync(pb: PPCRejectPBPtr): OSErr;
  334.  INLINE $205F,$7005,$A4DD,$3E80;
  335. FUNCTION PPCWrite(pb: PPCWritePBPtr;async: BOOLEAN): OSErr;
  336. FUNCTION PPCWriteSync(pb: PPCWritePBPtr): OSErr;
  337.  INLINE $205F,$7006,$A0DD,$3E80;
  338. FUNCTION PPCWriteAsync(pb: PPCWritePBPtr): OSErr;
  339.  INLINE $205F,$7006,$A4DD,$3E80;
  340. FUNCTION PPCRead(pb: PPCReadPBPtr;async: BOOLEAN): OSErr;
  341. FUNCTION PPCReadSync(pb: PPCReadPBPtr): OSErr;
  342.  INLINE $205F,$7007,$A0DD,$3E80;
  343. FUNCTION PPCReadAsync(pb: PPCReadPBPtr): OSErr;
  344.  INLINE $205F,$7007,$A4DD,$3E80;
  345. FUNCTION PPCEnd(pb: PPCEndPBPtr;async: BOOLEAN): OSErr;
  346. FUNCTION PPCEndSync(pb: PPCEndPBPtr): OSErr;
  347.  INLINE $205F,$7008,$A0DD,$3E80;
  348. FUNCTION PPCEndAsync(pb: PPCEndPBPtr): OSErr;
  349.  INLINE $205F,$7008,$A4DD,$3E80;
  350. FUNCTION PPCClose(pb: PPCClosePBPtr;async: BOOLEAN): OSErr;
  351. FUNCTION PPCCloseSync(pb: PPCClosePBPtr): OSErr;
  352.  INLINE $205F,$7009,$A0DD,$3E80;
  353. FUNCTION PPCCloseAsync(pb: PPCClosePBPtr): OSErr;
  354.  INLINE $205F,$7009,$A4DD,$3E80;
  355. FUNCTION IPCListPorts(pb: IPCListPortsPBPtr;async: BOOLEAN): OSErr;
  356. FUNCTION IPCListPortsSync(pb: IPCListPortsPBPtr): OSErr;
  357.  INLINE $205F,$700A,$A0DD,$3E80;
  358. FUNCTION IPCListPortsAsync(pb: IPCListPortsPBPtr): OSErr;
  359.  INLINE $205F,$700A,$A4DD,$3E80;
  360.  
  361. FUNCTION PPCKill(pb: PPCParamBlockPtr): OSErr;
  362.  INLINE $205F,$700B,$A0DD,$3E80;
  363.  
  364. FUNCTION DeleteUserIdentity(userRef: LONGINT): OSErr;
  365. FUNCTION GetDefaultUser(VAR userRef: LONGINT;
  366.                         VAR userName: Str32): OSErr;
  367. FUNCTION StartSecureSession(pb: PPCStartPBPtr;
  368.                             VAR userName: Str32;
  369.                             useDefault: BOOLEAN;
  370.                             allowGuest: BOOLEAN;
  371.                             VAR guestSelected: BOOLEAN;
  372.                             prompt: Str255): OSErr;
  373. FUNCTION PPCBrowser(prompt: Str255;
  374.                     applListLabel: Str255;
  375.                     defaultSpecified: BOOLEAN;
  376.                     VAR theLocation: LocationNameRec;
  377.                     VAR thePortInfo: PortInfoRec;
  378.                     portFilter: PPCFilterProcPtr;
  379.                     theLocNBPType: Str32): OSErr;
  380.  INLINE $303C,$0D00,$A82B;
  381.  
  382.  
  383. {$ENDC} { UsingPPCToolBox }
  384.  
  385. {$IFC NOT UsingIncludes}
  386.  END.
  387. {$ENDC}
  388.  
  389.